<?php

namespace App\Models\Goods;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Type extends Model
{
    use HasFactory;
//    public $table='types';
    public $guarded=['created_at','updated_at','deleted_at'];

    /**
     * 一个类型对应多个属性
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function attr(){
        return $this->hasMany(Attribute::class,'type_id','id');
    }

    /**
     * 一个类型对应多个规格
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function spec(){
        return $this->hasMany(Spec::class,'type_id','id');
    }
}
